<!--职业竞赛-结果公示-->
<template>
  <div class="form-container">
    <el-card class="box-card">
      <div class="card-header">
        <!-- 面包屑导航 -->
        <el-breadcrumb separator-class="el-icon-arrow-right">
          <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
<!--          <el-breadcrumb-item :to="{ path: '/teachers/teacherEdit'}">结果公示</el-breadcrumb-item>-->
          <el-breadcrumb-item>结果公示</el-breadcrumb-item>
        </el-breadcrumb>
      </div>
      <el-form :model="form" :rules="rules" ref="baseForm" label-width="120px">
        <div class="head-card">
          <!-- 讲师介绍 -->
          <el-form-item label="讲师介绍：" prop="user_phoneno" >
            <el-input
              v-model="form.teaDetails"
              placeholder="请输入"
              clearable
              type="textarea"
              rows="10"
            ></el-input>
          </el-form-item>
        </div>
        <!--         表单操作 -->
        <el-form-item>
          <el-button type="primary" :disabled="isButtonDisabled" @click="saveTeachers">保存</el-button>
          <el-button type="primary" @click="teacherCancel">取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script>
import {regjguserfail, createbt } from "../../api/InstitutionApi";
import {defineComponent} from "vue";

export default {
  data() {
    return {
      form: {
        teaName:'',
        teaZc:'',
        teaReg: '',
        teaDq:'',
        teaphone:'',
        teaWorkTime: '',
        teaTouX:'',
        teaVieo: '',
        teaDetails: ''

      },
      type: [
        {
          value: '护理',
          label: '护理'
        }, {
          value: '康养',
          label: '康养'
        },
      ],
      // 图片存储
      logoimgurl:'',
      doorimgurl:'',
      inImgurl: [],
      zizhaoImg: '',
      srcList:[],
      // 弹窗存储
      editFormVisible: false,
      unReview:'',
      addressOptions: [
        {
          value: 'zhejiang',
          label: '浙江省',
          children: [
            {
              value: 'hangzhou',
              label: '杭州市',
              children: [
                { value: 'xihu', label: '西湖区' },
                { value: 'binjiang', label: '滨江区' }
              ]
            }
          ]
        },
        {
          value: 'jiangsu',
          label: '江苏省',
          children: [
            {
              value: 'nanjing',
              label: '南京市',
              children: [
                { value: 'xuanwu', label: '玄武区' },
                { value: 'qinhuai', label: '秦淮区' }
              ]
            }
          ]
        }
      ]
    }
  },
  created() {
    // 对于 path: '/detail/:flowId' 的匹配
    // this.form = this.$route.query.flowid;
    // this.imgPhoto()
  },
  computed: {
    isButtonDisabled() {
      // return this.form.base.cur_status === 2; // 可以扩展其他条件，如 || this.isLoading
    }
  },
  methods: {
    disabled() {
      return disabled
    },
    // 保存
    saveTeachers() {
      createbt({
        "btname": this.form.teaName, //#师资名称
        "btphoneno": this.form.teaphone, //#师资手机号
        "btzhicheng": this.form.teaZc, //#师资职位
        "btzyly": this.form.teaReg, //#师资专业领域
        "btaddr": this.form.teaDq, //#师资地址
        "btworkdate": this.form.teaWorkTime, //#师资工作日期
        "btheaderuri": this.form.teaTouX, //#师资头像uri
        "btpersonvideouri": this.form.teaVieo,  //#师资个人视频uri
        "btdesc": this.form.teaDetails,  //#师资描述
      }).then(res=> {
        console.log('讲师保存',res)

      })
    },
    // 取消
    teacherCancel() {
      // 跳转页面的三种方式
      // 方式1：通过 path 跳转
      // this.$router.push({
      //   path: `/enterprises/EnEdit/:index`
      // });
      // 方式2：通过 name 跳转（推荐）
      // this.$router.push({
      //   name: 'enedit',
      //   params: { index: index }
      // });

      // 方式3：带查询参数（显示在URL中）
      this.$router.push({
        path: '/teachers/teachers',
        query: ''
      });

    },

    // 关闭编辑、增加弹出框
    closeDialog() {
      this.editFormVisible = false
    },


    // 审核不通过
    reviewUnBy(flowid){
      console.log('驳回-1：',flowid);
      regjguserfail({
        "flowid": flowid,
        "flowmsg": this.unReview,
      }).then(res => {
        console.log('驳回：',res,this.unReview);
        this.editFormVisible = false
      })
    },
    resetForm() {
      this.$refs.baseForm.resetFields();
      this.form.businessStatus = '营业中';
      this.form.logoUrl = '';
    },
    handleAvatarSuccess(res, file) {
      this.form.logoUrl = URL.createObjectURL(file.raw);
    },
    beforeAvatarUpload(file) {
      const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isJPG) {
        this.$message.error('上传头像图片只能是 JPG/PNG 格式!');
      }
      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!');
      }
      return isJPG && isLt2M;
    }
  }
}
</script>

<style scoped>
.form-container {
  max-width: 800px;
  margin: 20px auto;
}

.head-card {
  margin-bottom: 20px;
}

.card-header {
  margin-bottom: 30px;
}

.card-select {
  padding-left: 40px;
  font-size: 14px;
  margin-bottom: 30px;

}

.form-title {
  font-size: 18px;
  font-weight: bold;
}

.required-item >>> .el-form-item__label:before {
  content: "*";
  color: #f56c6c;
  margin-right: 4px;
}

.avatar-uploader {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  width: 150px;
  height: 150px;
}

.avatar-uploader:hover {
  border-color: #409EFF;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 150px;
  height: 150px;
  line-height: 150px;
  text-align: center;
}

.avatar {
  width: 100%;
  height: 100%;
  display: block;
}

.upload-tip {
  font-size: 12px;
  color: #909399;
  margin-top: 10px;
}
</style>
